Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added deviceorientationabsolute so absolute positioning with Android Chrome works #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MrBlenny
Copy link

@MrBlenny MrBlenny commented Feb 12, 2017

deviceorientation does not give absolute aka 'world' positioning on android chrome anymore. This PR fixes that.

I'm not sure if this breaks 'game' positioning in any way. This should be tested.

@FREEZX
Copy link

FREEZX commented Nov 12, 2017

This breaks support for firefox mobile, with the error DeviceOrientation is not supported.
Works fine on the original. I'm usinig the bundled js file along with gyronorm.

if (event.absolute === true) {
orientationChangeAbsolute = true;
}
if (event.absolute == orientationChangeAbsolute) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaks support for non-absolute browsers, like firefox mobile

@@ -1028,6 +1032,7 @@ FULLTILT.DeviceOrientation.prototype = {

if ( sensors.orientation.active ) {

window.removeEventListener( 'deviceorientationabsolute', handleDeviceOrientationChange, false );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix issues with firefox mobile, needs to be like this

				if ('ondeviceorientationabsolute' in window) {
					window.addEventListener( 'deviceorientationabsolute', handleDeviceOrientationChange, false );
				} else if ('ondeviceorientation' in window) {
					window.addEventListener( 'deviceorientation', handleDeviceOrientationChange, false );
				}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants